/*
 * @Description:
 * @Author: 稽辉
 * @Date: 2025-02-02 21:16:48
 * @LastEditTime: 2025-02-03 19:35:55
 * @LastEditors: 稽辉
 */
import type { AddressItem, AddressParams } from '@/types/address'
import { http } from '@/utils/http'

//封装地址修改/新建的api
export const postMemberAddressAPI = (data: AddressParams) => {
  return http({
    method: 'POST',
    url: '/member/address',
    data,
  })
}
//获取地址 列表
export const getMemberAdressAPI = () => {
  return http<AddressItem[]>({
    method: 'GET',
    url: '/member/address',
  })
}
//获取具体收货地址的接口
export const getMemberAddressByIdAPI = (id: string) => {
  return http<AddressItem>({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}
//保存修改后的收货地址的接口
export const putMemberAddressByIdAPI = (id: string, data: AddressParams) => {
  return http<AddressItem>({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}
//根据id删除地址记录
export const deleteMemberAddressByIdAPI = (id: string) => {
  return http({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}
